import json

from configs import QUERY_TRANS_DATA_FILE


def rewrite_query(query: str):
	with open(QUERY_TRANS_DATA_FILE, "r", encoding="utf-8") as f:
		trans_data = json.load(f)
	for key, values in trans_data.items():
		for value in values:
			if value in query and value:
				query = query.replace(value, key)
				break
	return query
